package D924;

import com.sun.org.glassfish.external.statistics.Statistic;

public class Guanli {


    int jia=0;

   Book[] zeng=new Book[5];



    void tian(Book a){
        zeng[jia]=a;
        System.out.println("您已经增加了"+(jia+1)+"本");
        jia++;
    }



    void shan(String Isbn){
        int cun=-1;
        for (int i = 0; i < jia; i++) {
            if (Isbn.equals(zeng[i].isbn)) {
                cun = i;
                break;
            }
        }
        if(cun==-1){
            System.out.println("没有要删除的书籍");
        }else{
            for (int j = cun; j < j-1; j++) {
                zeng[j]=zeng[j+1];

            }
            zeng[jia-1]=null;
        }

    }

    void cha(String zhao) {
        String xianshi="";
        for (int i = 0; i < jia; i++) {
            if (zhao.equals(zeng[i].isbn)) {
                if(zeng[i]!=null){
                    System.out.println("书名："+zeng[i].bname+" 作者："+zeng[i].zuozhe+" ISBN码："+zeng[i].isbn);
                }else{
                    System.out.println("没有找到此书！");
                }

                break;
            }
        }
    }

    //显示所有图书的方法
    void show() {
        for (int i1 = 0; i1 < zeng.length; i1++) {
            if (zeng[i1]!=null){
                zeng[i1].show();
            }

        }
    }
}
